#ifndef COMPONENT_H_
#define COMPONENT_H_

#include "LibraryFrameworkExport.h"

#include <string>
#include <iosfwd>

#include "AI/Messaging/Telegram.h"
#include "Game/GameTime.h"
#include "EventHandler/EventHandler.h"


namespace CasaEngine
{
	class BaseEntity;

	/*
	 *	
	 */
	class LIBRARY_FRAMEWORK_EXPORT Component : public EventHandler
	{

	private:
		BaseEntity* m_pEntity;
		int m_Type;

	protected:
		Component(BaseEntity* pEntity_, int type_);		

	public:
		virtual ~Component();

		/**
		 * 
		 */
		virtual bool HandleMessage( const Telegram& msg );

		//all entities must implement an Initialize function
		virtual void Initialize() = 0;

		//all entities must implement an update function
		virtual void  Update(const GameTime& gameTime_) = 0;

		//
		virtual void Draw();

		//all entities can communicate using messages. They are sent
		//using the MessageDispatcher singleton class
		//virtual void HandleEvent(const int msg_) = 0;

		BaseEntity* GetEntity() const;

		//entities should be able to read/write their data to a stream
		virtual void Write(std::ostream&  os) const;
		virtual void Read (std::ifstream& is);
	};

}

#endif // COMPONENT_H_


